﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.Security.Principal;
using System.Web.Profile;
using Vit.Web.Models;

namespace Vit.Web.Providers
{
    public interface IMembershipProvider : Vit.Common.IProvider
    {
        bool Login(string account, string password, bool rememberMe);
        void Logout();

        bool ChangePassword(string account, string oldPassword, string newPassword);
        User CreateUser(string name, string account, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, out string error);
        bool UpdateUser(User user);
        bool DeleteUser(string account, bool deleteAllRelatedData);
        bool LockUser(string account);
        bool UnlockUser(string account);
        bool ValidateUser(string account, string password);
        User GetUser(string account);
        string GetUserNameByEmail(string email);
        IQueryable<User> GetAllUsers(int pageIndex, int pageSize, out int totalRecords);
        int GetNumberOfUsersOnline();

        Role CreateRole(string roleName);
        bool DeleteRole(string roleName, bool throwOnPopulatedRole);
        IQueryable<Role> GetAllRoles();
        bool RoleExists(string roleName);
        bool AccountExists(string account);
        bool EmailExists(string email);

        bool CanUserAccess(string account, string permissionUri);
        bool CanRoleAccess(string rolename, string permissionUri);
    }
}
